package com.orangelife.service.feeDetail.impl;

import java.util.HashMap;
import java.util.Map;

import com.orangelife.service.Importlogs.QiniuUtils;

public class ImportLogs<T1,T> {
	
	public int snum=0;
	public int unum=0;
	public int errnum=0;
	private T1 importLog;
	
	public Map<String,Boolean> tasks=new HashMap<String,Boolean>();
	
	private T importService;
	
	public Map<Integer, String> errMap= new HashMap<Integer, String>();
	
	private boolean isbreak=false;

	public ImportLogs(T1 importLog,T importService){
		
		
		this.importLog=importLog;
		
		this.importService=importService;
	}

public synchronized void addSnum(){
	
	this.snum++;
	
} 
public synchronized void addUnum(){
	
	this.unum++;
	
} 
public synchronized void addErrnum(){
	
	this.errnum++;
	
} 	public Map<Integer, String> getErrMap() {
		return errMap;
	}



	public void setErrMap(Map<Integer, String> errMap) {
		this.errMap = errMap;
	}



	public T getImportService() {
		return importService;
	}



	public void setImportService(T importService) {
		this.importService = importService;
	}



	public T1 getImportLog() {
		return importLog;
	}



	public void setImportLog(T1 importLog) {
		this.importLog = importLog;
	}



	public boolean isIsbreak() {
		return isbreak;
	}



	public void setIsbreak(boolean isbreak) {
		this.isbreak = isbreak;
	}
	
	public String getErrUrl(){
		
		 	QiniuUtils qiniuUtils = new QiniuUtils();
		
		return 	qiniuUtils.createErrorLogFile(this.errMap);
	}



	public Map<String, Boolean> getTasks() {
		return tasks;
	}



	public void setTasks(Map<String, Boolean> tasks) {
		this.tasks = tasks;
	}
	
	
	public synchronized boolean checkIsOk(String i){
		
		this.tasks.put(i,true);
		boolean flag=true;
		for (String iii : this.tasks.keySet()) {
			
			if(!this.tasks.get(iii)){
				
				flag=false;
				break;
				
			}
			
		}
		
		return flag;
		
	}
	

}
